-
Notifications
You must be signed in to change notification settings - Fork 39
Add message, stream and URI factories for Slim Framework #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Build fails on PHP 5.4 because Slim requires PHP >=5.5.0. |
@tuupola thank you for the PR. Can you try adding https://github.com/akeneo/PhpSpecSkipExampleExtension and skip the tests on PHP 5.4? |
That might not be enough since also |
@php-http/owners how about dropping PHP 5.4 support of this package too? |
Dropping 5.4 is a no-brainer in my opinion. My general approach is that you should keep old PHP versions if there is no reson for bumping then. I believe @tuupola has an excellent reson here. We had a discussion on twitter about supporting 5.4 because legacy project would not be able to update to HTTPlug without dropping support for 5.4. (Because of php-http/discovery). |
As this library is only a dependency during development I would not use it as an argument to bump the minimum version requirements. Instead I would remove the dev requirement and install the package on Travis CI only for PHP >= 5.5 jobs and skip the example otherwise as @sagikazarmark suggested. |
@xabbuh the problem is that this way development is much harder. I would do the other way around: remove the library in CI on PHP 5.4. That way you can't develop it if you have 5.4, but the lib remains compatible with it. |
Sure, Im fine with that. |
@sagikazarmark Sounds good too. |
I already have it the way @xabbuh explained. However comment by @sagikazarmark makes sense. I will do it over and commit soonish. |
@@ -35,6 +35,9 @@ before_install: | |||
install: | |||
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction | |||
|
|||
before_script: | |||
- if [[ "${TRAVIS_PHP_VERSION}" == "5.4" ]]; then composer remove slim/slim; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this to before install AND add --no-update flag to composer. That way we only have to run compose once.
@@ -14,19 +14,22 @@ | |||
"php": ">=5.4", | |||
"psr/http-message": "^1.0", | |||
"php-http/message-factory": "^1.0.2", | |||
"clue/stream-filter": "^1.3" | |||
"clue/stream-filter": "^1.3", | |||
"slim/slim": "^3.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only dev requirement, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be yes. But this way it still wont still work because. You cannot do the composer install
and then composer remove slim/slim
with PHP 5.4 anyway since it is the composer install
which will fail. I try if --ignore-platform-reqs
helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand you. Also, please see my previous comment about moving the removal to before_install instead of before_script with --no-update. --no-update causes to update composer.json, but does not actually call install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah disregard last comment. I did not know you can run composer remove
with empty vendor.
}, | ||
"suggest": { | ||
"zendframework/zend-diactoros": "Used with Diactoros Factories", | ||
"guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", | ||
"slim/slim": "Used with Slim Factories", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diactoros and Guzzle PSR-7 are obviously meaning message factories while Slim is a framework. Can you please add some extra indication that it means message/PSR-7 factories? Just to avoid confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about wording. Maybe "Used with Slim Framework PSR-7 implementation"
or "Used with Slim Framework PSR-7 messages"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any of those work for me
Seems there is problem with streams with hhvm. Will install hhvm locally to figure it out. |
I would also like to add something to message factory tests. Namely I would like to test that factories set the message headers and body correctly. Should this be a separate PR? |
Great job. Thank you! |
@Nyholm there were some TODOs which indeed would have been nice to have here. |
Sorry, I must have missed that. I saw that you approved it so I made a final review myself. What were the TODOs? |
See the TODO section: puli.json, possibly rename to Slim3 |
Sorry for not bringing those up to discussion before merging. Yes, some entries should be added to Puli.json. The other two are fine IMHO |
I am not familiar with Puli. How should I add the entries to puli.json? I quickly read through puli docs but did not become any smarter. |
What's in this PR?
This PR adds message, stream and URI factories for Slim Framework
Why?
Slim is reasonably popular PSR-7 based framework.
Example Usage
Checklist
To Do
Slim3StreamFactory
andSlim3StreamFactory
instead?